#include "my_thread.h"


My_Thread::My_Thread(QObject *parent) : QThread(parent)
{

}

My_Thread::~My_Thread()
{
    qDebug()<<"child thread exit!";
}

void My_Thread::run()
{
    qDebug()<<"子线程线程ID: "<<QThread::currentThreadId();
    int i=0;
    for(;;){
        qDebug()<<i;
        emit threadSignal(i++);//发出信号，传值给主线程
         this->sleep(1);
        if(i>10){
            break;
        }
    }
}
